package com.njtoyo.taxi.admin.mongo.entity.primary;

import cn.hutool.core.date.DateUtil;

import lombok.Data;
import lombok.experimental.Accessors;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Document(collection = "ride_route")
@Data
@Accessors(chain = true)
public class RideRouteMongo {

    /**
     * ID
     */
    @Id
    private ObjectId id;

    /**
     * 行程ID
     */
    private Long rideId;

    /**
     * 行程类型
     */
    private String rideCategory;

    /**
     * 坐标点列表
     */
    private List<String> points;

    /**
     * 里程
     */
    private BigDecimal distance;

    /**
     * 时长
     */
    private Integer duration;

    /**
     * 创建时间字符串
     */
    private String createdAtStr = DateUtil.now();

    /**
     * 创建时间
     */
    @Indexed(expireAfterSeconds = 60 * 60 * 24 * 7,background = true)
    private Date createdAt = new Date();

}
